/*
 * Copyright 2010. 
 * 
 * This document may not be reproduced, distributed or used 
 * in any manner whatsoever without the expressed written 
 * permission of xrkol Corp. 
 * 
 * $Rev: Rev $
 * $Author: Author $
 * $LastChangedDate: LastChangedDate $
 *
 */

package com.xrkol.sharelib.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.xrkol.sharelib.dao.TeachingDao;
import com.xrkol.sharelib.entity.Clazz;
import com.xrkol.sharelib.entity.Teacher;
import com.xrkol.sharelib.entity.Teaching;

/**
 * @author peng.xia
 * 
 */
@Repository
public class TeachingDaoImpl extends BaseDaoImpl<Teaching, String> implements TeachingDao {

    @Override
    public List<Teaching> getByTeacher(Teacher currentUser) {
        String queryString = "from Teaching t where t.teacher=? order by t.createTime desc";
        return executeQueryWithoutPaging(queryString, currentUser);
    }

    @Override
    public List<Teaching> getByClass(Clazz clazz) {
        String queryString = "from Teaching t where t.clazz=?";
        return executeQueryWithoutPaging(queryString, clazz);
    }

    @Override
    public void deleteByClass(Clazz clazz) {
        String queryString = "delete from Teaching t where t.clazz=?";
        executeUpdateOrDelete(queryString, clazz);
    }

   
}
